<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri='http://java.sun.com/portlet' prefix='portlet'%>
<%@ page import="javax.portlet.*"%>
<%@ page import="java.util.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.model.*"%>
<%@ page import="cn.com.chinasoa.course.subscribe.util.*"%>
<%@ page import="com.x4ee.soa.portal.framework.tools.*"%>
<%@ page import="javax.persistence.*"%>
<%String contextPath = request.getContextPath();%>
<portlet:defineObjects />
<link href='<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/css/portlet.css' rel='stylesheet' type='text/css'/>
<SCRIPT language="JavaScript">var tImagePath="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/";</SCRIPT>
<script language="JavaScript"  type="text/javascript" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/javascript/TimePicker.js"></script>
<form method='post' action='<portlet:actionURL><portlet:param name="frameworkUri" value="trainingSubjectOperateAction"/><portlet:param name="cmd" value="edit"/></portlet:actionURL>'>
<table>
	<tr>
		<td valign="top">
			<table>
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="EditIndex"/></portlet:renderURL>'>[发布课程]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingSubjectCreate"/></portlet:renderURL>'>[授课科目]</a></td></tr>				
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="TrainingAddressCreate"/></portlet:renderURL>'>[授课地点]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="HELP"><portlet:param name="frameworkUri" value="PrivilegeStrategyCreate"/></portlet:renderURL>'>[优惠策略]</a></td></tr>
				<tr><td><a href='<portlet:renderURL portletMode="EDIT"><portlet:param name="frameworkUri" value="SubscribeOrderView"/></portlet:renderURL>'>[处理订单]</a></td></tr>
			</table>
		</td>
		<td>
			<table>
			<%List<TrainingSubject> tsList = ModelEntityHelper.listTrainingSubject();
			long trainingSubjectId = DataTypeUtil.parseLong(renderRequest.getParameter("trainingSubjectId"));
					EntityManager em = EntityManagerHelper.getEntityManager();
					if(trainingSubjectId>=0){
						TrainingSubject tts = em.find(TrainingSubject.class,trainingSubjectId);
						if(tts!=null){%><input name="trainingSubjectId" type="hidden" value="<%=trainingSubjectId%>"/>			
<tr><th colspan="2" align="left" style="font-size: 13">新增授课科目</th></tr>
<tr><td colspan="2"><table><tr><td align="left">课程编号:</td><td><input name="code"  value="<%=tts.getCode()%>" type="text" size="40" class="textfield"/></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">课程概要:</td><td><textarea name="summary" type="text" cols="40" rows="3"><%=tts.getSummary()%></textarea></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">课程天数:</td><td><input name="period"  value="<%=tts.getPeriod()%>" type="text" size="1" class="textfield"/>&nbsp天</td>
</tr></table></td></tr><tr><td colspan="2"><table><tr><td align="left">课程类型:</td><td><select name="type"><option value="jboss"  <%if(tts.getType().equals("jboss")){%>selected="selected"<%}%>>jboss</option><option value="soa" <%if(tts.getType().equals("soa")){%>selected="selected"<%}%>>soa</option></select></td></tr></table></td></tr>					
<tr><td colspan="2"><table><tr><td align="left">开始时间:</td><td><input name="startTime" type='text' value="<%=DataTypeUtil.renderTimeAMPM(tts.getStartTime())%>" size=8 maxlength=8 onblur="validateDatePicker(this)"><img src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/timepicker.gif" border="0" onClick="selectTime(this,startTime)" style="cursor:hand"></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">结束时间:</td><td><input name="endTime" type='text' value="<%=DataTypeUtil.renderTimeAMPM(tts.getEndTime())%>" size=8 maxlength=8 onblur="validateDatePicker(this)"><img src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/timepicker.gif" border="0" onClick="selectTime(this,endTime)" style="cursor:hand"></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">课程描述:</td><td><textarea name="description" type="text" cols="40" rows="3"><%=tts.getDescription()%></textarea></td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left">课程价格:</td><td><input name="price" type="text"  value="<%=tts.getPrice()%>" size="1" class="textfield"/>&nbspRMB</td></tr></table></td></tr>
<tr><td colspan="2"><table><tr><td align="left"><input type="image" src="<%=contextPath%><%=ConfigUtils.getResourceBasePath(renderRequest)%>/image/edit.jpg" name="Submit" value="新增"></td></tr></table></td></tr>
			<%}}EntityManagerHelper.closeEntityManager();%></table>
		</td>
		<td valign="top">
			<table border="1">
			<tr><td>类型</td><td>培训编号</td><td>开始时间</td><td>结束时间</td><td>天数</td><td>价格</td><td>操作</td></tr>
			<%for(Iterator<TrainingSubject> tsIt = tsList.iterator();tsIt.hasNext();){
				TrainingSubject ts = tsIt.next();%>
				<tr><td><strong><%=ts.getType()%></strong></td>
				<td><a href="#" title="<%=ts.getSummary()%>"><strong><%=ts.getCode()%></strong></a></td>
				<td><strong><%=DataTypeUtil.renderTimeAMPM(ts.getStartTime())%></strong></td>
				<td><strong><%=DataTypeUtil.renderTimeAMPM(ts.getEndTime())%></strong></td>
				<td><a href="#" title="<%=ts.getDescription()%>"><strong><%=ts.getPeriod()%></strong></a></td>
				<td><%=ts.getPrice()%></td>
<td><a href="<portlet:renderURL><portlet:param name="frameworkUri" value="TrainingSubjectEdit"/><portlet:param name="trainingSubjectId" value="<%=ts.getId()+""%>"/></portlet:renderURL>">[编辑]</a>
<a href="<portlet:actionURL><portlet:param name="frameworkUri" value="trainingSubjectOperateAction"/><portlet:param name="trainingSubjectId" value="<%=ts.getId()+""%>"/><portlet:param name="cmd" value="delete"/></portlet:actionURL>">[删除]</a>				
				</td></tr><%
			}%>
			</table>
		</td>
	</tr>
</table>
</form>	
